package yyy.ab.modules.quartz.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import yyy.ab.common.core.Query;
import yyy.ab.modules.quartz.entity.QuartzJob;
import yyy.ab.modules.quartz.mapper.QuartzJobMapper;
import yyy.ab.modules.quartz.service.QuartzJobService;

import java.util.List;
import java.util.Map;

@Service
@RequiredArgsConstructor
public class QuartzJobServiceImpl implements QuartzJobService {

    private final QuartzJobMapper baseMapper;

    /**
     * 查找所有任务触发器数据
     *
     * @return
     */
    @Override
    public List<QuartzJob> findAll() {
        return baseMapper.findAll();
    }

    /**
     * 查询分页数据
     *
     * @param param
     * @return
     */
    @Override
    public IPage<QuartzJob> findPage(Map<String, Object> param) {
        Page<QuartzJob> page = new Query<QuartzJob>(param).getPage();

        return baseMapper.findPage(page, param);
    }
}
